<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>测试js数组包含</title>
</head>
<body>
<script type="text/javascript">
    var k=[1,2,3]
    // -1
    alert(k.indexOf(4))
    //false
    alert(k.includes(4));
    //true
    alert(k.includes(3));
</script>
</body>
</html>